﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace LLClient.SaveAndLoad
{
    public static class Serializer
    {
        public static void SerializeLLFile(string filename, LLFile LLFileToSerialize)
        {
            Stream stream = File.Open(filename, FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();
            bFormatter.Serialize(stream, LLFileToSerialize);
            stream.Close();
        }

        public static LLFile DeSerializeLLFile(string filename)
        {
            LLFile LLFileToDeserialize;
            Stream stream = File.Open(filename, FileMode.Open);
            BinaryFormatter dFormatter = new BinaryFormatter();
            LLFileToDeserialize = (LLFile)dFormatter.Deserialize(stream);
            stream.Close();
            return LLFileToDeserialize;
        }
    }
}
